/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sni.org.pe.model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Ericson
 */
@Entity
@Table(name = "opcion_sistema")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "OpcionSistema.findAll", query = "SELECT o FROM OpcionSistema o"),
    @NamedQuery(name = "OpcionSistema.findByIdopsist", query = "SELECT o FROM OpcionSistema o WHERE o.idopsist = :idopsist"),
    @NamedQuery(name = "OpcionSistema.findByImagenopsist", query = "SELECT o FROM OpcionSistema o WHERE o.imagenopsist = :imagenopsist"),
    @NamedQuery(name = "OpcionSistema.findByNombreopsist", query = "SELECT o FROM OpcionSistema o WHERE o.nombreopsist = :nombreopsist"),
    @NamedQuery(name = "OpcionSistema.findByUrlopsist", query = "SELECT o FROM OpcionSistema o WHERE o.urlopsist = :urlopsist"),
    @NamedQuery(name = "OpcionSistema.findByTooltipopsist", query = "SELECT o FROM OpcionSistema o WHERE o.tooltipopsist = :tooltipopsist"),
    @NamedQuery(name = "OpcionSistema.findByEstadoopsist", query = "SELECT o FROM OpcionSistema o WHERE o.estadoopsist = :estadoopsist")})
public class OpcionSistema implements Serializable {
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "opcionSistema", fetch = FetchType.EAGER)
    private List<PerfilOpcionSistema> perfilOpcionSistemaList;

    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idopsist")
    private BigDecimal idopsist;
    @Size(max = 60)
    @Column(name = "imagenopsist")
    private String imagenopsist;
    @Size(max = 60)
    @Column(name = "nombreopsist")
    private String nombreopsist;
    @Size(max = 250)
    @Column(name = "urlopsist")
    private String urlopsist;
    @Size(max = 150)
    @Column(name = "tooltipopsist")
    private String tooltipopsist;
    @Column(name = "estadoopsist")
    private BigInteger estadoopsist;
    @JoinTable(name = "perfil_opcion_sistema", joinColumns = {
        @JoinColumn(name = "idopsist", referencedColumnName = "idopsist")}, inverseJoinColumns = {
        @JoinColumn(name = "idperfil", referencedColumnName = "idperfil")})
    @ManyToMany(fetch = FetchType.EAGER)
    private List<Perfil> perfilList;
    @OneToMany(mappedBy = "idpadreopsist", fetch = FetchType.EAGER)
    private List<OpcionSistema> opcionSistemaList;
    @JoinColumn(name = "idpadreopsist", referencedColumnName = "idopsist")
    @ManyToOne(fetch = FetchType.EAGER)
    private OpcionSistema idpadreopsist;
    @Column(name = "ismenuitem")
    private BigInteger ismenuitem;

    public OpcionSistema() {
    }

    public OpcionSistema(BigDecimal idopsist) {
        this.idopsist = idopsist;
    }

    public BigDecimal getIdopsist() {
        return idopsist;
    }

    public void setIdopsist(BigDecimal idopsist) {
        this.idopsist = idopsist;
    }

    public String getImagenopsist() {
        return imagenopsist;
    }

    public void setImagenopsist(String imagenopsist) {
        this.imagenopsist = imagenopsist;
    }

    public String getNombreopsist() {
        return nombreopsist;
    }

    public void setNombreopsist(String nombreopsist) {
        this.nombreopsist = nombreopsist;
    }

    public String getUrlopsist() {
        return urlopsist;
    }

    public void setUrlopsist(String urlopsist) {
        this.urlopsist = urlopsist;
    }

    public String getTooltipopsist() {
        return tooltipopsist;
    }

    public void setTooltipopsist(String tooltipopsist) {
        this.tooltipopsist = tooltipopsist;
    }

    public BigInteger getEstadoopsist() {
        return estadoopsist;
    }

    public void setEstadoopsist(BigInteger estadoopsist) {
        this.estadoopsist = estadoopsist;
    }

    @XmlTransient
    public List<Perfil> getPerfilList() {
        return perfilList;
    }

    public void setPerfilList(List<Perfil> perfilList) {
        this.perfilList = perfilList;
    }

    @XmlTransient
    public List<OpcionSistema> getOpcionSistemaList() {
        return opcionSistemaList;
    }

    public void setOpcionSistemaList(List<OpcionSistema> opcionSistemaList) {
        this.opcionSistemaList = opcionSistemaList;
    }

    public OpcionSistema getIdpadreopsist() {
        return idpadreopsist;
    }

    public void setIdpadreopsist(OpcionSistema idpadreopsist) {
        this.idpadreopsist = idpadreopsist;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idopsist != null ? idopsist.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OpcionSistema)) {
            return false;
        }
        OpcionSistema other = (OpcionSistema) object;
        if ((this.idopsist == null && other.idopsist != null) || (this.idopsist != null && !this.idopsist.equals(other.idopsist))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "sni.org.pe.model.OpcionSistema[ idopsist=" + idopsist + " ]";
    }

    public BigInteger getIsmenuitem() {
        return ismenuitem;
    }

    public void setIsmenuitem(BigInteger ismenuitem) {
        this.ismenuitem = ismenuitem;
    }

    @XmlTransient
    public List<PerfilOpcionSistema> getPerfilOpcionSistemaList() {
        return perfilOpcionSistemaList;
    }

    public void setPerfilOpcionSistemaList(List<PerfilOpcionSistema> perfilOpcionSistemaList) {
        this.perfilOpcionSistemaList = perfilOpcionSistemaList;
    }
}
